<template>
   <i class="icon el-icon-arrow-left back" @click='btnClick' v-if="isshowBack"></i>
</template>
<script>
  export default {
    name: 'BackSideBar',
    data () {
      return {
      }
    },
    props: {
      type: {type: String, default: ''}
    },
    methods: {
      btnClick () { // 根据父级传的type,各个模块的处理
        if (this.type === 'business') {
          this.$store.commit('business/SET_BUSINESS_IS_SHOW_BOX', {isShow: false})
        } else if (this.type === 'customer') {
          this.$store.commit('customer/SET_CUSTOMER_IS_SHOW_BOX', {isShow: false})
        }
      }
    },
    computed: {
      isshowBack () { // 是否展示返回按钮
        return this.$store.state.isNewCardStyle[this.type]
      }
    }
  }
</script>
<style lang="stylus" scoped>
  .icon
    width 18px
    height 18px
    line-height 18px
    border 1px solid #459ae9
    border-radius 50%
    text-align center
    color #459ae9
    cursor pointer
    margin-right 10px
    margin-top 10px
</style>
